package cn.xopencode.securityservice.provider.activity;

import cn.xopencode.common.framework.vo.CommonResult;
import cn.xopencode.common.framework.vo.PageResult;
import cn.xopencode.securityservice.rpc.activity.ActivityRpc;
import cn.xopencode.securityservice.rpc.activity.dto.ActivityCreateReqDTO;
import cn.xopencode.securityservice.rpc.activity.dto.ActivityPageReqDTO;
import cn.xopencode.securityservice.rpc.activity.dto.ActivityRespDTO;
import cn.xopencode.securityservice.service.activity.ActivityService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import static cn.xopencode.common.framework.vo.CommonResult.success;

/**
 * 安全活动与技能比武情况 Rpc 实现
 */
@DubboService(version = "${dubbo.provider.ActivityRpc.version}")
public class ActivityRpcProviderImpl implements ActivityRpc {

    @Autowired
    private ActivityService activityService;


    @Override
    public CommonResult<ActivityRespDTO> getActivity(String activityId) {
        return success(activityService.getActivity(activityId));
    }

    @Override
    public CommonResult<Integer> createActivity(ActivityCreateReqDTO createDTO) {
        return success(activityService.createActivity(createDTO));
    }

    @Override
    public CommonResult<PageResult<ActivityRespDTO>> pageActivity(ActivityPageReqDTO pageDTO) {
        return success(activityService.pageActivity(pageDTO));
    }
}
